
<%@ page import="com.webboard.Post" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="layout" content="main" />
  <g:set var="entityName" value="${message(code: 'post.label', default: 'Post')}" />
  <title><g:message code="default.list.label" args="[entityName]" /></title>
</head>
<body>
<g:isLoggedIn>
  <div class="nav">
    <span class="menuButton"><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></span>
  </div>
</g:isLoggedIn>
<div class="body">
  <h1><g:message code="default.list.label" args="[entityName]" /></h1>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <div class="list">
    <table>
      <thead>
        <tr>

    <!--g:sortableColumn property="id" title="${message(code: 'post.id.label', default: 'Id')}" /-->

      <g:sortableColumn property="title" title="${message(code: 'post.title.label', default: 'Title')}" />

      <g:sortableColumn property="username" title="${message(code: 'post.username.label', default: 'Username')}" />

    <!--g:sortableColumn property="text" title="${message(code: 'post.text.label', default: 'Text')}" /-->

      <!--th><g:message code="post.user.label" default="User" /></th-->
      <th><g:message code="post.numOfReplies.label" default="Num Of Replies" /></th>
      <g:sortableColumn property="postDate" title="${message(code: 'post.postDate.label', default: 'Post Date')}" />

      </tr>
      </thead>
      <tbody>
      <g:each in="${postInstanceList}" status="i" var="postInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

    <!--td><g:link action="show" id="${postInstance.id}">${fieldValue(bean: postInstance, field: "id")}</g:link></td-->

          <td><g:link action="show" id="${postInstance.id}">${fieldValue(bean: postInstance, field: "title")}</g:link></td>

        <td>${fieldValue(bean: postInstance, field: "username")}</td>

    <!--td>${fieldValue(bean: postInstance, field: "text")}</td-->

    <!--td>${fieldValue(bean: postInstance, field: "user")}</td-->

        <td>${postInstance.replies.size()}</td>
        <td><g:formatDate date="${postInstance.postDate}" /></td>

        </tr>
      </g:each>
      </tbody>
    </table>
  </div>
  <div class="paginateButtons">
    <g:paginate total="${postInstanceTotal}" />
  </div>
</div>
</body>
</html>
